module Codewars.Puzzle (testit) where

import Data.List as L

testit :: [Int] -> [Int] -> [Int]
testit a b = merge x y
    where x = sort $ nub a
          y = sort $ nub b

merge :: [Int] -> [Int] -> [Int]
merge [] ys = ys
merge xs [] = xs
merge allx@(x:xs) ally@(y:ys)
    | x `compare` y <= EQ = x : merge xs ally
    | otherwise = y : merge allx ys


-- after solution
testit2 = (. sort) (. nub) ++ . nub
testit3 x y = sort( nub x ++ nub y )
